package com.yonyou.isv.demo.openapi.entity.output_invoice;

import java.util.*;

/**
 *未开票收入管理
 * */
public class InvoiceWill {
    /**
     * 未开票记录变更查询
     * */
    public static Map<String, Object> change() {
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        paramsMap.put("beginTime","2019-10-24 16:31:15");
        paramsMap.put("endTime","2023-01-01 16:31:15");
        paramsMap.put("orgCode", "123456789");
        paramsMap.put("pageNum", 1);
        paramsMap.put("pageSize", 10);
        return paramsMap;
    }

    /**
     * 未开票查询
     */
    public static Map<String, Object> result() {
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        //来源单据号
        //paramsMap.put("lyid", "123131312313");
        //单据请求流水号；单据请求流水号和来源单据号不能同时为空
        paramsMap.put("djqqlsh", "1554714477459877888");
        //开票点编码
        paramsMap.put("orgCode", "123456789");
        paramsMap.put("pageNum", "1");
        paramsMap.put("pageSize", "10");
        return paramsMap;
    }

    //新增未开票
    public static Map<String, Object> save(String djqqlsh) {
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        //来源单据号
        paramsMap.put("lyid", "12324523234");
        //单据请求流水号
        paramsMap.put("djqqlsh", djqqlsh);
        //开票点编码
        paramsMap.put("orgCode", "123456789");
        paramsMap.put("gmfMc", "广州佰仕德材料科技有限公司");
        paramsMap.put("gmfNsrsbh", "111222333456111");
        paramsMap.put("gmfYhzh", "中国农业银行股份有限公司广州花都名门支行 44087001040011474");
        paramsMap.put("gmfDzdh", "广州市花都区红棉大道北16号4楼4B07室 020-61796191");
        paramsMap.put("lc", "2");
        paramsMap.put("bz", "测试");
        paramsMap.put("fplx", "1");
        paramsMap.put("zdrq","2020-09-09");
        paramsMap.put("invoiceWillBs",buildWillbs());
        return paramsMap;
    }

    private static Object buildWillbs() {
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        paramsMap.put("xmmc", "硅胶5299B");
        paramsMap.put("xmjshj", 40);
        paramsMap.put("hh","1");
        paramsMap.put("spbm", "1070213070000000000");
        paramsMap.put("sl", 0.16);
        return paramsMap;
    }
    //新增红字信息表
    public static Map<String, Object> apply(String fpqqlsh) {
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        paramsMap.put("orgCode", "30400001");
        //信息表申请类型：购买方申请已抵扣：1100000000；购买方申请未抵扣：1010000000；销售方申请：0000000100
        paramsMap.put("reqMemo", "0000000100");
        paramsMap.put("yfpHm", "03166143");
        paramsMap.put("yfpDm", "1111100004");
        paramsMap.put("gmfMc", "11134444");
        paramsMap.put("gmfNsrsbh", "33333333");
        paramsMap.put("xsfMc", "测试333");
        paramsMap.put("xsfNsrsbh", "111222333456333");
        paramsMap.put("kprq","20220702");
        paramsMap.put("items",buildItems());
        paramsMap.put("hjje",-31.71);
        paramsMap.put("hjse",-0.29);
        paramsMap.put("jshj",-32.00);
        paramsMap.put("reqBillNo",fpqqlsh);
        paramsMap.put("urls","http://47x826661y.qicp.vip/kaipiao/callback1");
        return paramsMap;
    }

    /**
     * 构造request发票明细
     */
    private static List<Object> buildItems() {
        List<Object> items = new ArrayList<Object>();
        Map<String, Object> data1 = new HashMap<String, Object>();
        data1.put("xmmc", "333物料");
        data1.put("ysxmmc", "333物料");
        data1.put("xmje",-31.17);
        data1.put("se", -0.29);
        data1.put("xmjshj", -32.00);
        //data1.put("ggxh", "规格型号");
        //data1.put("dw", "单位");
        //data1.put("xmdj","单价");
        //data1.put("xmsl", "数量");
        //税率16%需要写成0.16的格式
        data1.put("sl", 0.03);
        data1.put("spbm", "3213124314324322");
        items.add(data1);
        return items;
    }

    /**
     * 销项查询并推送档案服务
     * @return
     */
    public static Map<String, Object> outputQueryBillspush() {
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        paramsMap.put("callbackUrl", "https://idoc.diwork.com//cloudrecord-imw/api/nc/v1/doc/push?corpId=1634");
        paramsMap.put("showUpper", "1");
        paramsMap.put("taskId", "S202111-173490-a559dc1db5f2");
        paramsMap.put("type", "fa_fixedasset_FixedAssetsInfo");
        paramsMap.put("docPkList", Arrays.asList(new String[]{"2444139785392640"}));
        Map<String, Object> fileServer = new HashMap<String, Object>();
        fileServer.put("accessKey", "idocyonyoucloudcom");
        fileServer.put("bucketName", "idoc");
        fileServer.put("endpoint", "https://yonbip.diwork.com/yonbip-fi-eaffile/cloudrecord-file");
        fileServer.put("secretKey", "idocyonyoucloudcom");
        fileServer.put("serverType", "gateway");
        paramsMap.put("fileServer", fileServer);
        Map<String, Object> orgInfo = new HashMap<String, Object>();
        orgInfo.put("code", "001_0001");
        orgInfo.put("type", "book");
        paramsMap.put("orgInfo", orgInfo);
        return paramsMap;
    }

    /**
     * 进项查询并推送档案服务
     * @return
     */
    public static Map<String, Object> inputQueryBillspush() {
        Map<String, Object> paramsMap = new HashMap<String, Object>();
        paramsMap.put("callbackUrl", "https://idoc.diwork.com//cloudrecord-imw/api/nc/v1/doc/push?corpId=1634");
        paramsMap.put("showUpper", "1");
        paramsMap.put("taskId", "S202111-173490-a559dc1db5f2");
        paramsMap.put("type", "fa_fixedasset_FixedAssetsInfo");
        paramsMap.put("docPkList", Arrays.asList(new String[]{"2444139785392640"}));
        Map<String, Object> fileServer = new HashMap<String, Object>();
        fileServer.put("accessKey", "idocyonyoucloudcom");
        fileServer.put("bucketName", "idoc");
        fileServer.put("endpoint", "https://yonbip.diwork.com/yonbip-fi-eaffile/cloudrecord-file");
        fileServer.put("secretKey", "idocyonyoucloudcom");
        fileServer.put("serverType", "gateway");
        paramsMap.put("fileServer", fileServer);
        Map<String, Object> orgInfo = new HashMap<String, Object>();
        orgInfo.put("code", "001_0001");
        orgInfo.put("type", "book");
        paramsMap.put("orgInfo", orgInfo);
        return paramsMap;
    }
}
